<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>精选文章推荐 - 多元社交</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            --primary: #165DFF;
            --primary-light: #E8F3FF;
            --secondary: #0FC6C2;
            --text-dark: #1D2129;
            --text-gray: #4E5969;
            --text-light: #86909C;
            --border: #E5E6EB;
            --bg-light: #F2F3F5;
            --success: #00B42A;
            --warning: #FF7D00;
            --danger: #F53F3F;
            --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
            --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
        }

        body {
            font-family: 'Inter', system-ui, -apple-system, sans-serif;
            color: var(--text-dark);
            background-color: #F7F8FA;
            line-height: 1.5;
        }

        /* 导航栏样式 */
        .navbar {
            background-color: white;
            border-bottom: 1px solid var(--border);
            padding: 0.75rem 1.5rem;
        }

        .navbar-brand {
            color: var(--primary);
            font-weight: 700;
            font-size: 1.5rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .nav-link {
            color: var(--text-gray);
            margin: 0 0.5rem;
            font-weight: 500;
            transition: color 0.2s;
        }

        .nav-link:hover, .nav-link.active {
            color: var(--primary);
        }

        .search-box {
            position: relative;
            max-width: 400px;
            width: 100%;
        }

        .search-input {
            width: 100%;
            padding: 0.5rem 1rem 0.5rem 2.5rem;
            border-radius: 6px;
            border: 1px solid var(--border);
            background-color: var(--bg-light);
            font-size: 0.9rem;
        }

        .search-input:focus {
            outline: none;
            border-color: var(--primary);
        }

        .search-icon {
            position: absolute;
            left: 0.8rem;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-light);
        }

        /* 主内容区 */
        .main-container {
            padding: 2rem 0;
        }

        .section-title {
            font-size: 1.5rem;
            font-weight: 700;
            margin-bottom: 1.5rem;
            padding-bottom: 0.75rem;
            border-bottom: 2px solid var(--primary-light);
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .section-title i {
            color: var(--primary);
        }

        .card {
            border: none;
            border-radius: 8px;
            box-shadow: var(--shadow);
            transition: transform 0.2s, box-shadow 0.2s;
            overflow: hidden;
        }

        .card:hover {
            transform: translateY(-3px);
            box-shadow: var(--shadow-hover);
        }

        /* 文章项通用样式 */
        .article-item {
            background-color: white;
            border-radius: 8px;
            box-shadow: var(--shadow);
            margin-bottom: 1.5rem;
            overflow: hidden;
            transition: transform 0.2s, box-shadow 0.2s;
        }

        .article-item:hover {
            transform: translateY(-3px);
            box-shadow: var(--shadow-hover);
        }

        .article-header {
            padding: 1rem 1.25rem;
            display: flex;
            align-items: center;
            gap: 0.75rem;
            border-bottom: 1px solid var(--border);
        }

        .author-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            object-fit: cover;
        }

        .author-info {
            flex: 1;
        }

        .author-name {
            font-weight: 600;
            font-size: 0.95rem;
            color: var(--text-dark);
            text-decoration: none;
        }

        .author-name:hover {
            color: var(--primary);
            text-decoration: underline;
        }

        .article-time {
            font-size: 0.85rem;
            color: var(--text-light);
        }

        .article-content {
            padding: 1rem 1.25rem;
        }

        .article-title {
            font-size: 1.15rem;
            font-weight: 600;
            margin-bottom: 0.75rem;
            color: var(--text-dark);
            text-decoration: none;
            transition: color 0.2s;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .article-title:hover {
            color: var(--primary);
        }

        .article-excerpt {
            color: var(--text-gray);
            font-size: 0.95rem;
            margin-bottom: 1rem;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .article-metrics {
            display: flex;
            align-items: center;
            gap: 1.5rem;
            font-size: 0.85rem;
            color: var(--text-light);
        }

        .metric-item {
            display: flex;
            align-items: center;
            gap: 0.35rem;
        }

        .article-actions {
            display: flex;
            gap: 0.5rem;
            margin-left: auto;
        }

        .action-btn {
            color: var(--text-light);
            background: none;
            border: none;
            padding: 0.35rem 0.75rem;
            border-radius: 4px;
            font-size: 0.85rem;
            display: flex;
            align-items: center;
            gap: 0.35rem;
            transition: all 0.2s;
        }

        .action-btn:hover {
            background-color: var(--bg-light);
            color: var(--primary);
        }

        .action-btn.liked {
            color: var(--danger);
        }

        .action-btn.bookmarked {
            color: var(--warning);
        }

        /* 无图片文章样式 */
        .no-image-article {
            padding: 1rem 1.25rem;
        }

        /* 单图片文章样式 */
        .single-image-container {
            width: 100%;
            height: 200px;
            overflow: hidden;
        }

        .single-image {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.3s ease;
        }

        .article-item:hover .single-image {
            transform: scale(1.03);
        }

        /* 多图片文章样式 */
        .multi-image-grid {
            display: grid;
            gap: 4px;
            margin-bottom: 1rem;
        }

        .two-images {
            grid-template-columns: 1fr 1fr;
            height: 180px;
        }

        .three-images {
            grid-template-columns: 1fr 1fr;
            grid-template-rows: 1fr 1fr;
            height: 240px;
        }

        .three-images img:first-child {
            grid-column: 1 / 3;
            grid-row: 1 / 2;
        }

        .four-images {
            grid-template-columns: 1fr 1fr;
            grid-template-rows: 1fr 1fr;
            height: 240px;
        }

        .multi-image {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.3s ease;
        }

        .article-item:hover .multi-image {
            transform: scale(1.03);
        }

        /* 网格布局样式 */
        .articles-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 1.5rem;
        }

        /* 列表布局样式 */
        .articles-list .article-item {
            display: flex;
        }

        .articles-list .image-container {
            width: 200px;
            flex-shrink: 0;
        }

        .articles-list .single-image-container {
            height: 100%;
        }

        .articles-list .article-content {
            flex: 1;
            display: flex;
            flex-direction: column;
        }

        .articles-list .article-excerpt {
            flex: 1;
        }

        @media (max-width: 768px) {
            .articles-list .article-item {
                flex-direction: column;
            }

            .articles-list .image-container {
                width: 100%;
                height: 180px;
            }

            .two-images, .three-images, .four-images {
                height: 160px;
            }
        }

        /* 切换布局控制 */
        .layout-controls {
            display: flex;
            gap: 1rem;
            margin-bottom: 1.5rem;
            padding: 1rem;
            background-color: white;
            border-radius: 8px;
            box-shadow: var(--shadow);
        }

        .layout-btn {
            background-color: var(--bg-light);
            border: none;
            border-radius: 6px;
            padding: 0.5rem 1rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-weight: 500;
            color: var(--text-gray);
            transition: all 0.2s;
        }

        .layout-btn:hover, .layout-btn.active {
            background-color: var(--primary);
            color: white;
        }

        /* 分类标签 */
        .category-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 0.75rem;
            margin-bottom: 1.5rem;
        }

        .category-tag {
            padding: 0.35rem 1rem;
            border-radius: 20px;
            background-color: white;
            border: 1px solid var(--border);
            color: var(--text-gray);
            font-size: 0.9rem;
            text-decoration: none;
            transition: all 0.2s;
        }

        .category-tag:hover, .category-tag.active {
            background-color: var(--primary);
            color: white;
            border-color: var(--primary);
        }

        /* 加载更多按钮 */
        .load-more {
            display: block;
            margin: 2rem auto;
            padding: 0.75rem 2rem;
            background-color: white;
            border: 1px solid var(--primary);
            color: var(--primary);
            border-radius: 6px;
            font-weight: 500;
            transition: all 0.2s;
        }

        .load-more:hover {
            background-color: var(--primary);
            color: white;
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg">
        <div class="container">
            <a class="navbar-brand" href="#">
                <i class="fas fa-connectdevelop"></i> 多元社交
            </a>
            
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarContent">
                <i class="fas fa-bars"></i>
            </button>
            
            <div class="collapse navbar-collapse" id="navbarContent">
                <div class="d-flex justify-content-center flex-grow-1">
                    <div class="search-box">
                        <i class="fas fa-search search-icon"></i>
                        <input type="text" class="search-input" placeholder="搜索文章、话题或用户...">
                    </div>
                </div>
                
                <ul class="navbar-nav ms-auto">
                    <li class="nav-item">
                        <a class="nav-link active" href="#"><i class="fas fa-home"></i> 首页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#"><i class="fas fa-compass"></i> 发现</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#"><i class="fas fa-bell"></i> 通知</a>
                    </li>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                            <img src="https://picsum.photos/100/100?random=1" alt="用户头像" class="rounded-circle" style="width: 36px; height: 36px; object-fit: cover;">
                        </a>
                        <ul class="dropdown-menu dropdown-menu-end">
                            <li><a class="dropdown-item" href="#"><i class="fas fa-user me-2"></i> 个人主页</a></li>
                            <li><a class="dropdown-item" href="#"><i class="fas fa-bookmark me-2"></i> 我的收藏</a></li>
                            <li><a class="dropdown-item" href="#"><i class="fas fa-cog me-2"></i> 设置</a></li>
                            <li><hr class="dropdown-divider"></li>
                            <li><a class="dropdown-item" href="#"><i class="fas fa-sign-out-alt me-2"></i> 退出登录</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
    
    <!-- 主内容区 -->
    <div class="container main-container">
        <h2 class="section-title"><i class="fas fa-fire"></i> 精选文章推荐</h2>
        
        <!-- 分类标签 -->
        <div class="category-tags">
            <a href="#" class="category-tag active">全部</a>
            <a href="#" class="category-tag">科技</a>
            <a href="#" class="category-tag">生活</a>
            <a href="#" class="category-tag">旅行</a>
            <a href="#" class="category-tag">美食</a>
            <a href="#" class="category-tag">职场</a>
            <a href="#" class="category-tag">情感</a>
            <a href="#" class="category-tag">健康</a>
        </div>
        
        <!-- 布局切换控制 -->
        <div class="layout-controls">
            <button class="layout-btn active" data-layout="mixed">
                <i class="fas fa-th-large"></i> 混合布局
            </button>
            <button class="layout-btn" data-layout="list">
                <i class="fas fa-list"></i> 列表布局
            </button>
            <button class="layout-btn" data-layout="grid">
                <i class="fas fa-th"></i> 网格布局
            </button>
        </div>
        
        <!-- 文章推荐容器 -->
        <div class="articles-container" id="articlesContainer">
            <!-- 无图片文章 -->
            <div class="article-item no-image-article">
                <div class="article-header">
                    <img src="https://picsum.photos/100/100?random=10" alt="张明" class="author-avatar">
                    <div class="author-info">
                        <a href="#" class="author-name">张明</a>
                        <div class="article-time">2小时前</div>
                    </div>
                </div>
                <div class="article-content">
                    <h3><a href="#" class="article-title">如何有效提升工作效率：分享我多年来的时间管理心得</a></h3>
                    <p class="article-excerpt">在当今快节奏的工作环境中，高效的时间管理成为了职场成功的关键因素。本文将分享我多年来总结的时间管理方法，包括番茄工作法的实践技巧、任务优先级排序策略以及如何避免常见的时间浪费陷阱...</p>
                    <div class="article-metrics">
                        <div class="metric-item">
                            <i class="far fa-eye"></i>
                            <span>2.5k 阅读</span>
                        </div>
                        <div class="metric-item">
                            <i class="far fa-comment"></i>
                            <span>86 评论</span>
                        </div>
                        <div class="article-actions">
                            <button class="action-btn liked">
                                <i class="fas fa-heart"></i>
                                <span>342</span>
                            </button>
                            <button class="action-btn">
                                <i class="far fa-bookmark"></i>
                                <span>收藏</span>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 单图片文章 -->
            <div class="article-item">
                <div class="article-header">
                    <img src="https://picsum.photos/100/100?random=11" alt="李华" class="author-avatar">
                    <div class="author-info">
                        <a href="#" class="author-name">李华</a>
                        <div class="article-time">昨天 15:30</div>
                    </div>
                </div>
                <div class="single-image-container">
                    <img src="https://picsum.photos/800/400?random=20" alt="山间日出风景" class="single-image">
                </div>
                <div class="article-content">
                    <h3><a href="#" class="article-title">徒步黄山三日游：最佳路线与绝美风景分享</a></h3>
                    <p class="article-excerpt">黄山以奇松、怪石、云海、温泉"四绝"闻名于世，是无数徒步爱好者的向往之地。本文分享我三天两夜的黄山徒步经历，包括详细路线规划、住宿推荐以及各个观景点的最佳观赏时间...</p>
                    <div class="article-metrics">
                        <div class="metric-item">
                            <i class="far fa-eye"></i>
                            <span>5.8k 阅读</span>
                        </div>
                        <div class="metric-item">
                            <i class="far fa-comment"></i>
                            <span>124 评论</span>
                        </div>
                        <div class="article-actions">
                            <button class="action-btn">
                                <i class="far fa-heart"></i>
                                <span>786</span>
                            </button>
                            <button class="action-btn bookmarked">
                                <i class="fas fa-bookmark"></i>
                                <span>收藏</span>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 两张图片文章 -->
            <div class="article-item">
                <div class="article-header">
                    <img src="https://picsum.photos/100/100?random=12" alt="王芳" class="author-avatar">
                    <div class="author-info">
                        <a href="#" class="author-name">王芳</a>
                        <div class="article-time">3天前</div>
                    </div>
                </div>
                <div class="article-content">
                    <h3><a href="#" class="article-title">新手必学的两道家常菜：番茄炒蛋与鱼香肉丝</a></h3>
                    <p class="article-excerpt">对于烹饪新手来说，掌握几道简单又美味的家常菜是建立信心的关键。今天分享两道国民家常菜的详细做法，步骤清晰，成功率高，即使是厨房小白也能轻松驾驭...</p>
                    <div class="multi-image-grid two-images">
                        <img src="https://picsum.photos/400/300?random=30" alt="番茄炒蛋" class="multi-image">
                        <img src="https://picsum.photos/400/300?random=31" alt="鱼香肉丝" class="multi-image">
                    </div>
                    <div class="article-metrics">
                        <div class="metric-item">
                            <i class="far fa-eye"></i>
                            <span>4.2k 阅读</span>
                        </div>
                        <div class="metric-item">
                            <i class="far fa-comment"></i>
                            <span>98 评论</span>
                        </div>
                        <div class="article-actions">
                            <button class="action-btn">
                                <i class="far fa-heart"></i>
                                <span>532</span>
                            </button>
                            <button class="action-btn">
                                <i class="far fa-bookmark"></i>
                                <span>收藏</span>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 三张图片文章 -->
            <div class="article-item">
                <div class="article-header">
                    <img src="https://picsum.photos/100/100?random=13" alt="刘强" class="author-avatar">
                    <div class="author-info">
                        <a href="#" class="author-name">刘强</a>
                        <div class="article-time">上周</div>
                    </div>
                </div>
                <div class="article-content">
                    <h3><a href="#" class="article-title">2023年最新笔记本电脑选购指南：从办公到游戏全推荐</a></h3>
                    <p class="article-excerpt">随着科技的快速发展，笔记本电脑市场也在不断更新换代。本文将从不同使用场景出发，推荐适合办公、设计、游戏等不同需求的笔记本电脑，并分析各款产品的优缺点和选购建议...</p>
                    <div class="multi-image-grid three-images">
                        <img src="https://picsum.photos/800/400?random=40" alt="办公笔记本" class="multi-image">
                        <img src="https://picsum.photos/400/400?random=41" alt="设计笔记本" class="multi-image">
                        <img src="https://picsum.photos/400/400?random=42" alt="游戏笔记本" class="multi-image">
                    </div>
                    <div class="article-metrics">
                        <div class="metric-item">
                            <i class="far fa-eye"></i>
                            <span>12.7k 阅读</span>
                        </div>
                        <div class="metric-item">
                            <i class="far fa-comment"></i>
                            <span>326 评论</span>
                        </div>
                        <div class="article-actions">
                            <button class="action-btn liked">
                                <i class="fas fa-heart"></i>
                                <span>1543</span>
                            </button>
                            <button class="action-btn">
                                <i class="far fa-bookmark"></i>
                                <span>收藏</span>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 四张图片文章 -->
            <div class="article-item">
                <div class="article-header">
                    <img src="https://picsum.photos/100/100?random=14" alt="陈静" class="author-avatar">
                    <div class="author-info">
                        <a href="#" class="author-name">陈静</a>
                        <div class="article-time">1周前</div>
                    </div>
                </div>
                <div class="article-content">
                    <h3><a href="#" class="article-title">日本东京五日自由行攻略：从浅草寺到富士山的完美旅程</a></h3>
                    <p class="article-excerpt">东京作为日本的首都，融合了传统与现代的独特魅力。这份五日游攻略将带您领略东京的标志性景点，品尝地道美食，体验当地文化，并提供实用的交通和住宿建议...</p>
                    <div class="multi-image-grid four-images">
                        <img src="https://picsum.photos/400/400?random=50" alt="浅草寺" class="multi-image">
                        <img src="https://picsum.photos/400/400?random=51" alt="东京塔" class="multi-image">
                        <img src="https://picsum.photos/400/400?random=52" alt="富士山" class="multi-image">
                        <img src="https://picsum.photos/400/400?random=53" alt="日式美食" class="multi-image">
                    </div>
                    <div class="article-metrics">
                        <div class="metric-item">
                            <i class="far fa-eye"></i>
                            <span>8.9k 阅读</span>
                        </div>
                        <div class="metric-item">
                            <i class="far fa-comment"></i>
                            <span>215 评论</span>
                        </div>
                        <div class="article-actions">
                            <button class="action-btn">
                                <i class="far fa-heart"></i>
                                <span>967</span>
                            </button>
                            <button class="action-btn bookmarked">
                                <i class="fas fa-bookmark"></i>
                                <span>收藏</span>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 加载更多按钮 -->
        <button class="load-more">
            <i class="fas fa-sync-alt me-2"></i>加载更多文章
        </button>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 布局切换功能
            const layoutButtons = document.querySelectorAll('.layout-btn');
            const articlesContainer = document.getElementById('articlesContainer');
            
            layoutButtons.forEach(button => {
                button.addEventListener('click', function() {
                    // 移除所有按钮的活跃状态
                    layoutButtons.forEach(btn => btn.classList.remove('active'));
                    // 添加当前按钮的活跃状态
                    this.classList.add('active');
                    
                    // 获取要切换的布局类型
                    const layoutType = this.getAttribute('data-layout');
                    
                    // 移除所有布局类
                    articlesContainer.classList.remove('articles-mixed', 'articles-list', 'articles-grid');
                    
                    // 添加选中的布局类
                    if (layoutType === 'list') {
                        articlesContainer.classList.add('articles-list');
                    } else if (layoutType === 'grid') {
                        articlesContainer.classList.add('articles-grid');
                    } else {
                        articlesContainer.classList.add('articles-mixed');
                    }
                });
            });
            
            // 分类标签切换
            const categoryTags = document.querySelectorAll('.category-tag');
            categoryTags.forEach(tag => {
                tag.addEventListener('click', function(e) {
                    e.preventDefault();
                    // 移除所有标签的活跃状态
                    categoryTags.forEach(t => t.classList.remove('active'));
                    // 添加当前标签的活跃状态
                    this.classList.add('active');
                    
                    // 这里可以添加筛选文章的逻辑
                    const category = this.textContent;
                    console.log(`筛选分类: ${category}`);
                });
            });
            
            // 点赞按钮交互
            const likeButtons = document.querySelectorAll('.action-btn:has(.fa-heart)');
            likeButtons.forEach(button => {
                button.addEventListener('click', function() {
                    const likeCount = this.querySelector('span');
                    let count = parseInt(likeCount.textContent);
                    
                    if (this.classList.contains('liked')) {
                        // 取消点赞
                        this.classList.remove('liked');
                        this.innerHTML = '<i class="far fa-heart"></i><span>' + (count - 1) + '</span>';
                    } else {
                        // 点赞
                        this.classList.add('liked');
                        this.innerHTML = '<i class="fas fa-heart"></i><span>' + (count + 1) + '</span>';
                    }
                });
            });
            
            // 收藏按钮交互
            const bookmarkButtons = document.querySelectorAll('.action-btn:has(.fa-bookmark)');
            bookmarkButtons.forEach(button => {
                button.addEventListener('click', function() {
                    if (this.classList.contains('bookmarked')) {
                        // 取消收藏
                        this.classList.remove('bookmarked');
                        this.innerHTML = '<i class="far fa-bookmark"></i><span>收藏</span>';
                    } else {
                        // 收藏
                        this.classList.add('bookmarked');
                        this.innerHTML = '<i class="fas fa-bookmark"></i><span>收藏</span>';
                    }
                });
            });
            
            // 加载更多按钮
            const loadMoreBtn = document.querySelector('.load-more');
            loadMoreBtn.addEventListener('click', function() {
                // 显示加载状态
                this.innerHTML = '<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>加载中...';
                this.disabled = true;
                
                // 模拟加载延迟
                setTimeout(() => {
                    // 恢复按钮状态
                    this.innerHTML = '<i class="fas fa-sync-alt me-2"></i>加载更多文章';
                    this.disabled = false;
                    
                    // 这里可以添加实际加载更多文章的逻辑
                    alert('已加载全部文章');
                }, 1500);
            });
        });
    </script>
</body>
</html>
    
